var Colors = require("Colors");

cc.Class({
    extends: cc.Component,

    properties: {
        gameName: {default:null, displayName: "游戏名称", type:cc.Node},
        bg: {default:null, displayName: "背景", type:cc.Node},
        startBtn: {default:null, displayName: "游戏开始", type:cc.Node},
        btnEffect: cc.AudioClip
    },

    onLoad: function () {
        // 背景铺平
        this.bg.width = cc.winSize.width;
        this.bg.height = cc.winSize.height;
        this.bg.setPosition(this.bg.width/2,this.bg.height/2);
        // 设置文字
        var action = cc.repeatForever(cc.sequence(cc.scaleTo(1, 1.5),cc.scaleTo(1,1)));
        this.gameName.runAction(action);
        this.gameName.setPosition(cc.winSize.width/2,cc.winSize.height/2);
        // 设置按钮位置
        this.startBtn.setPosition(this.gameName.getPositionX(),this.gameName.getPositionY()-210);
        // var action = cc.repeatForever(cc.sequence(cc.scaleTo(1,1.2),cc.scaleTo(1,1)));
        // this.startBtn.runAction(action);
    },

    startGame:function(){
        cc.audioEngine.playEffect(this.btnEffect);
        cc.director.loadScene("gameScene");
    }

});
